﻿@{
    Layout = "_Layout";
    ViewData["Title"] = "SysGenProjectInfo";
}

<el-container>
    <avue-crud :data="tableData" :option="option" :permission="hasPermission" :page.sync="pageOption" :table-loading="loading"
               v-on:refresh-change="refreshChange"
               v-on:row-save="handleRowSave"
               v-on:row-update="handleRowUpdate"
               v-on:row-del="handleRowDel"
               v-on:search-change="searchChange"
               v-on:search-reset="resetChange"
               :cell-style="cellStyle"
               v-on:on-load="onLoad">
        <template slot="record" slot-scope="scope">
            <modify-record :data="scope.row"></modify-record>
        </template>
    </avue-crud>
</el-container>

@section Scripts {
    <script src="~/js/filesaver.min.js"></script>
    <script src="~/js/xlsx.full.min.js"></script>
    <script>
        new Vue({
            el: '#app',
            mixins: [curdMixin],
            data() {
                return {

                    name: "projectInfo",
                    pageUrl: `/projectInfo/pages`,
                    addUrl: `/projectInfo/add`,
                    editUrl: `/projectInfo/update`,
                    deleteUrl: `/projectInfo/delete`,

                    option: {
                        searchShowBtn: Permissions.avePermission(`projectInfo:searchBtn`),
                        refreshBtn: Permissions.avePermission(`projectInfo:searchBtn`),
                        menuWidth: '350',
                        rowKey: 'id',
                        searchShow: false,
                        column: [
                           { prop: "id", label: `${this.i18n.t('primary_key')}`, search: false, hide: true, type: "number", display: false, showColumn: false, },
                           { prop: "name", label: `名称`, slot: true, span: 24, search: true, hide: false, width: '220', clearable: true, rules: [{ required: true, trigger: "blur", message: `${this.i18n.t('pleaseenter')}` }], },
                           { prop: "code", label: `项目代码`, slot: true, span: 24, search: true, hide: false, width: '220', clearable: true, rules: [{ required: true, trigger: "blur", message: `${this.i18n.t('pleaseenter')}` }], },
                           { prop: "authorName", label: `作者名`, slot: true, span: 24, search: true, hide: false, width: '120', clearable: true },
                           { prop: "templateContent", label: `模板`,type:'select',multiple:true,dicUrl:"/FileTemplate/list", props: {label: "name",value: "id",},
                                limit:7, slot: true, span: 24, search: true, hide: false, clearable: true, rules: [{ required: true, trigger: "blur", message: `${this.i18n.t('pleaseenter')}` }], },
                        ],
                    },

                }
            },
            created() {
                this.selectRow = {};
            },
            methods: {
                cellStyle({ row, column, rowIndex, columnIndex }) {
                    if (columnIndex == 7) {
                        if (row.isDisable == 0) {
                            return { color: '#409eff', }
                        }
                        else {
                            return { color: '#f56c6c', }
                        }
                    }
                },
            }
        });
    </script>

}